package com.yuxi.Service.Impl;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yuxi.Config.ConfigStatic;
import com.yuxi.Dao.InformationDao;
import com.yuxi.Dao.TaskDispatchDao;
import com.yuxi.Entity.Information;
import com.yuxi.Entity.TaskDispatch;
import com.yuxi.Entity.UserInfo;
import com.yuxi.Service.InformationFlowService;
import com.yuxi.Service.UserDoRecordService;
import com.yuxi.Service.UserService;
import com.yuxi.Service.UserSubService;
import com.yuxi.Util.StringManageUtil;
@Service
public class UserSubServiceImpl implements UserSubService {
	@Autowired
	private InformationDao  informationDao;
	@Autowired
	private UserService userService;
	@Autowired
	private InformationFlowService  informationFlowService;
	@Autowired
	private TaskDispatchDao taskDispatchDao;
	@Autowired
	private UserDoRecordService  userDoRecordService;
	private Logger logger=LoggerFactory.getLogger(UserSubServiceImpl.class);
	@Override
	public boolean subToFirstCheck(int informationId, UserInfo u, String ip) {
		Information information=informationDao.getInformationById(informationId);
		try{			
			information.setFlowId(Integer.toString(ConfigStatic.FLOWTABLE.get("FirstCheck")));
			information.setFlowName("初审");
			informationDao.modifyInformation(information);			
			informationFlowService.createInformationFlow(ConfigStatic.FLOWTABLE.get("FirstCheck"), informationId,u.getUserId(),"提交到初审",u.getUserName(),"提交");
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到初审成功",u.getUserName());
			logger.info("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到初审成功");
			return true;
		}catch(Exception e){
			e.printStackTrace();
			
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到初审失败",u.getUserName());
			logger.error("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到初审失败");
			return false;
		}
	}

	@Override
	public boolean subToReCheck(int informationId, UserInfo u, String ip,String remark,String operation) {
		Information information=informationDao.getInformationById(informationId);
		try{			
			information.setFlowId(Integer.toString(ConfigStatic.FLOWTABLE.get("ReCheck")));
			information.setFlowName("复核");
			informationDao.modifyInformation(information);
			informationFlowService.createInformationFlow(ConfigStatic.FLOWTABLE.get("ReCheck"), informationId,u.getUserId(),remark,u.getUserName(),operation);
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到复核成功",u.getUserName());
			logger.info("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到复核成功");
			return true;
		}catch(Exception e){
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到复核失败",u.getUserName());
			logger.error("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到复核失败");
			return false;
		}
	}

	@Override
	public boolean subToCheck(int informationId, UserInfo u, String ip,String remark,String operation) {
		Information information=informationDao.getInformationById(informationId);
		try{			
			information.setFlowId(Integer.toString(ConfigStatic.FLOWTABLE.get("Check")));
			information.setFlowName("审核");
			informationDao.modifyInformation(information);
			informationFlowService.createInformationFlow(ConfigStatic.FLOWTABLE.get("Check"), informationId,u.getUserId(),remark,u.getUserName(),operation);
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到审核成功",u.getUserName());
			logger.info("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到审核成功");
			return true;
		}catch(Exception e){
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到审核失败",u.getUserName());
			logger.error("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到审核失败");
			return false;
		}
	}
	@Override
	public boolean subToCheck(int informationId, UserInfo u, String ip,String remark ) {
		Information information=informationDao.getInformationById(informationId);
		try{			
			information.setFlowId(Integer.toString(ConfigStatic.FLOWTABLE.get("Check")));
			information.setFlowName("审核");
			informationDao.modifyInformation(information);
			informationFlowService.createInformationFlow(ConfigStatic.FLOWTABLE.get("Check"), informationId,u.getUserId(),remark,u.getUserName());
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到审核成功",u.getUserName());
			logger.info("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到审核成功");
			return true;
		}catch(Exception e){
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到审核失败",u.getUserName());
			logger.error("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到审核失败");
			return false;
		}
	}
	
	@Override
	public boolean subToCheck(int informationId, UserInfo u, String ip) {
		Information information=informationDao.getInformationById(informationId);
		try{			
			information.setFlowId(Integer.toString(ConfigStatic.FLOWTABLE.get("Check")));
			information.setFlowName("审核");
			informationDao.modifyInformation(information);
			informationFlowService.createInformationFlow(ConfigStatic.FLOWTABLE.get("Check"), informationId,u.getUserId());
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到审核成功",u.getUserName());
			logger.info("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到审核成功");
			return true;
		}catch(Exception e){
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到审核失败",u.getUserName());
			logger.error("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到审核失败");
			return false;
		}
	}
	@Override
	public boolean subToInfoResearch(int informationId, UserInfo u, String ip,String remark) {
		Information information=informationDao.getInformationById(informationId);
		try{			
			information.setFlowId(Integer.toString(ConfigStatic.FLOWTABLE.get("InfoResearch")));
			information.setFlowName("信息研判");
			informationDao.modifyInformation(information);
			informationFlowService.createInformationFlow(ConfigStatic.FLOWTABLE.get("InfoResearch"), informationId,u.getUserId(),remark,u.getUserName());
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到信息研判成功",u.getUserName());
			logger.info("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到信息研判成功");
			return true;
		}catch(Exception e){
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到信息研判失败",u.getUserName());
			logger.error("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到信息研判失败");
			return false;
		}
	}
	@Override
	public boolean subToInfoResearch(int informationId, UserInfo u, String ip,String remark,String operation) {
		Information information=informationDao.getInformationById(informationId);
		try{			
			information.setFlowId(Integer.toString(ConfigStatic.FLOWTABLE.get("InfoResearch")));
			information.setFlowName("信息研判");
			informationDao.modifyInformation(information);
			informationFlowService.createInformationFlow(ConfigStatic.FLOWTABLE.get("InfoResearch"), informationId,u.getUserId(),remark,u.getUserName(),operation);
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到信息研判成功",u.getUserName());
			logger.info("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到信息研判成功");
			return true;
		}catch(Exception e){
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到信息研判失败",u.getUserName());
			logger.error("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到信息研判失败");
			return false;
		}
	}
	@Override
	public boolean subToInfoResearch(int informationId, UserInfo u, String ip) {
		Information information=informationDao.getInformationById(informationId);
		try{			
			information.setFlowId(Integer.toString(ConfigStatic.FLOWTABLE.get("InfoResearch")));
			information.setFlowName("信息研判");
			informationDao.modifyInformation(information);
			informationFlowService.createInformationFlow(ConfigStatic.FLOWTABLE.get("InfoResearch"), informationId,u.getUserId());
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到信息研判成功",u.getUserName());
			logger.info("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到信息研判成功");
			return true;
		}catch(Exception e){
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到信息研判失败",u.getUserName());
			logger.error("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到信息研判失败");
			return false;
		}
	}

	@Override
	public boolean subToTaskDispatch(int informationId, UserInfo u, String ip) {
		Information information=informationDao.getInformationById(informationId);
		try{			
			information.setFlowId(Integer.toString(ConfigStatic.FLOWTABLE.get("TaskDispatch")));
			information.setFlowName("任务派遣");
			informationDao.modifyInformation(information);
			informationFlowService.createInformationFlow(ConfigStatic.FLOWTABLE.get("TaskDispatch"), informationId,u.getUserId(),"提交到任务派遣",u.getUserName(),"研判");
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到任务派遣成功",u.getUserName());
			logger.info("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到任务派遣成功");
			return true;
		}catch(Exception e){
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到任务派遣失败",u.getUserName());
			logger.error("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到任务派遣失败");
			return false;
		}
	}

	@Override
	public boolean subToCurTaskDispatch(int informationId, UserInfo u, String ip,String remark) {
		Information information=informationDao.getInformationById(informationId);
		try{			
			information.setFlowId(Integer.toString(ConfigStatic.FLOWTABLE.get("CurTaskDispatch")));
			information.setFlowName("即时任务派遣");
			informationDao.modifyInformation(information);
			informationFlowService.createInformationFlow(ConfigStatic.FLOWTABLE.get("TaskDispatch"), informationId,u.getUserId(),remark,u.getUserName(),"即时任务派遣");
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到即时任务派遣成功",u.getUserName());
			logger.info("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到即时任务派遣成功");
			return true;
		}catch(Exception e){
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到即时任务派遣失败",u.getUserName());
			logger.error("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到即时任务派遣失败");
			return false;
		}
	}

	@Override
	public boolean subToTaskFinsh(int informationId, UserInfo u, String ip,int taskType) {
		Information information=informationDao.getInformationById(informationId);
		try{			
			information.setFlowId(Integer.toString(ConfigStatic.FLOWTABLE.get("TaskFinish")));
			information.setFlowName("任务完成情况");
			information.setTaskDispatchName(u.getUserName());
			information.setTaskDispatchTime(Long.toString(System.currentTimeMillis()));
			informationDao.modifyInformation(information);
			informationFlowService.createInformationFlow(ConfigStatic.FLOWTABLE.get("TaskFinish"), informationId,u.getUserId(),"派遣任务",u.getUserName(),"任务派遣");
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "任务派遣成功",u.getUserName());
			
			String[] idArray=StringManageUtil.removeDot(information.getZeRenPersonId()).split(",");
			String[] nameArray=StringManageUtil.removeDot(information.getZeRenPerSonNames()).split(",");
			String remark=information.getZeRenRemark();
			for(int i=0;i<idArray.length;i++){
				TaskDispatch tDispatch=new TaskDispatch(informationId, Integer.parseInt(idArray[i]), nameArray[i], u.getUserId(), u.getUserName(), System.currentTimeMillis(), 0, Long.parseLong(information.getZeRenTime()), 0, remark, 0, taskType);
				taskDispatchDao.addDispatch(tDispatch);
			}
			logger.info("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"任务派遣成功");
			return true;
		}catch(Exception e){
			e.printStackTrace();
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "任务派遣失败",u.getUserName());
			logger.error("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"任务派遣失败");
			return false;
		}
	}

	@Override
	public boolean subToInfoComment(int informationId, UserInfo u, String ip) {
		Information information=informationDao.getInformationById(informationId);
		try{			
			information.setFlowId(Integer.toString(ConfigStatic.FLOWTABLE.get("InfoComment")));
			information.setFlowName("任务点评");
			informationDao.modifyInformation(information);
			informationFlowService.createInformationFlow(ConfigStatic.FLOWTABLE.get("InfoComment"), informationId,u.getUserId(),"点评信息",u.getUserName(),"点评");
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "任务完成",u.getUserName());
			logger.info("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"任务完成");
			return true;
		}catch(Exception e){
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "任务完成",u.getUserName());
			logger.error("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"任务完成失败");
			return false;
		}
	}

	@Override
	public boolean subToInfoEvaluation(int informationId, UserInfo u, String ip) {
		Information information=informationDao.getInformationById(informationId);
		try{			
			information.setFlowId(Integer.toString(ConfigStatic.FLOWTABLE.get("InfoEvaluation")));
			information.setFlowName("任务评价");
			informationDao.modifyInformation(information);
			informationFlowService.createInformationFlow(ConfigStatic.FLOWTABLE.get("InfoEvaluation"), informationId,u.getUserId(),"评价信息",u.getUserName(),"评价");
//			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到任务评价",u.getUserName());
			logger.info("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到任务评价成功");
			return true;
		}catch(Exception e){
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到任务评价",u.getUserName());
			logger.error("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到任务评价失败");
			return false;
		}
	}

	@Override
	public boolean subToInfoFinish(int informationId, UserInfo u, String ip,String remark) {
		Information information=informationDao.getInformationById(informationId);
		try{			
			information.setFlowId(Integer.toString(ConfigStatic.FLOWTABLE.get("InfoFinish")));
			information.setFlowName("任务结束");
			informationDao.modifyInformation(information);
			informationFlowService.createInformationFlow(ConfigStatic.FLOWTABLE.get("InfoFinish"), informationId,u.getUserId(),remark,u.getUserName(),"结束");
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到任务结束",u.getUserName());
			logger.info("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到任务结束成功");
			return true;
		}catch(Exception e){
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到任务结束",u.getUserName());
			logger.error("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到任务结束失败");
			return false;
		}
	}
	
	@Override
	public boolean subToInfoFinish(int informationId, UserInfo u, String ip ) {
		Information information=informationDao.getInformationById(informationId);
		try{			
			information.setFlowId(Integer.toString(ConfigStatic.FLOWTABLE.get("InfoFinish")));
			information.setFlowName("任务结束");
			informationDao.modifyInformation(information);
			informationFlowService.createInformationFlow(ConfigStatic.FLOWTABLE.get("InfoFinish"), informationId,u.getUserId(),u.getUserName(),"结束信息");
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到任务结束",u.getUserName());
			logger.info("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到任务结束成功");
			return true;
		}catch(Exception e){
			userDoRecordService.createUserDoRecord(informationId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "提交到任务结束",u.getUserName());
			logger.error("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到任务结束失败");
			return false;
		}
	}
	@Override
	public boolean ReToInfoMannger(int infoId, UserInfo u, String ip,String remark) {
		Information information=informationDao.getInformationById(infoId);
		try{			
			information.setFlowId(Integer.toString(ConfigStatic.FLOWTABLE.get("InfoManage")));
			information.setFlowName("信息管理");
			informationDao.modifyInformation(information);			
			informationFlowService.createInformationFlow(ConfigStatic.FLOWTABLE.get("FirstCheck"), infoId,u.getUserId(),remark,u.getUserName());
			userDoRecordService.createUserDoRecord(infoId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "退回到信息管理成功",u.getUserName());
			logger.info("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"退回回到信息管理成功");
			return true;
		}catch(Exception e){
			e.printStackTrace();
			
			userDoRecordService.createUserDoRecord(infoId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "退回到信息管理失败",u.getUserName());
			logger.error("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"退回到信息管理失败");
			return false;
		}
	}
	@Override
	public boolean ReToInfoMannger(int infoId, UserInfo u, String ip,String remark,String operation) {
		Information information=informationDao.getInformationById(infoId);
		try{			
			information.setFlowId(Integer.toString(ConfigStatic.FLOWTABLE.get("InfoManage")));
			information.setFlowName("信息管理");
			informationDao.modifyInformation(information);			
			informationFlowService.createInformationFlow(ConfigStatic.FLOWTABLE.get("InfoManage"), infoId,u.getUserId(),remark,u.getUserName(),operation);
			userDoRecordService.createUserDoRecord(infoId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "退回到信息管理成功",u.getUserName());
			logger.info("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"退回到信息管理成功");
			return true;
		}catch(Exception e){
			e.printStackTrace();
			
			userDoRecordService.createUserDoRecord(infoId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "退回到信息管理失败",u.getUserName());
			logger.error("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"退回到信息管理失败");
			return false;
		}
	}
	@Override
	public boolean dispatchInfoToAny(Integer infoId, Integer flowId, UserInfo u, String ip) {
		Information information=informationDao.getInformationById(infoId);
		try{	
			taskDispatchDao.delTimeOutInfoRecord(infoId);
			String flowName=getFlowNameById(flowId);
			String flowInName=Integer.toString(flowId);
			information.setFlowId(flowInName);			
			information.setFlowName(flowName);
			informationDao.modifyInformation(information);			
			informationFlowService.createInformationFlow(flowId, infoId,u.getUserId());
			userDoRecordService.createUserDoRecord(infoId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationDispatch"), "信息调配成功",u.getUserName());
			logger.info("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"信息调配成功");
			return true;
		}catch(Exception e){
			e.printStackTrace();			
			userDoRecordService.createUserDoRecord(infoId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationDispatch"), "信息调配失败",u.getUserName());
			logger.error("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"信息调配失败");
			return false;
		}
	}
	
	private String getFlowNameById(Integer flowId){
		switch (flowId) {
		case 1:
			return "信息管理";
		case 2:
			return "信息初审";
		case 3:
			return "信息复核";
		case 4:
			return "信息审核";
		case 5:
			return "信息研判";
		case 6:
			return "任务派遣";
		case 7:
			return "即时任务派遣";	
		}
		return "";
	}

	@Override
	public boolean reCheckToFirstCheck(Integer infoId,String remark, UserInfo user, String ip,String operation) {
		Information information=informationDao.getInformationById(infoId);
		try{			
			information.setFlowId(Integer.toString(ConfigStatic.FLOWTABLE.get("FirstCheck")));
			information.setFlowName("初审");
			informationDao.modifyInformation(information);			
			informationFlowService.createInformationFlow(ConfigStatic.FLOWTABLE.get("FirstCheck"), infoId,user.getUserId(),remark,user.getUserName(),operation);
			userDoRecordService.createUserDoRecord(infoId, user.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "退回到信息初审成功",user.getUserName());
			logger.info("用户："+user.getUserId()+" 信息编号："+information.getInformationAccount()+"退回到信息初审成功");
			return true;
		}catch(Exception e){
			e.printStackTrace();
			userDoRecordService.createUserDoRecord(infoId, user.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "退回到信息初审失败",user.getUserName());
			logger.error("用户："+user.getUserId()+" 信息编号："+information.getInformationAccount()+"退回到信息初审失败");
			return false;
		}
	}

	@Override
	public boolean firstCheckFinshInfoById(Integer infoId, UserInfo u, String remark,String ip) {
		Information information=informationDao.getInformationById(infoId);
		try{			
			information.setFlowId(Integer.toString(ConfigStatic.FLOWTABLE.get("InfoFinish")));
			information.setFlowName("任务结束");
			informationDao.modifyInformation(information);
			informationFlowService.createInformationFlow(ConfigStatic.FLOWTABLE.get("InfoFinish"), infoId,u.getUserId(),u.getUserName(),remark);
			userDoRecordService.createUserDoRecord(infoId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "初审合并结束流程",u.getUserName());
			logger.info("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到任务结束成功");
			return true;
		}catch(Exception e){
			userDoRecordService.createUserDoRecord(infoId, u.getUserId(), ip, ConfigStatic.DOTYPETABLE.get("InformationSub"), "初审合并结束流程",u.getUserName());
			logger.error("用户："+u.getUserId()+" 信息编号："+information.getInformationAccount()+"提交到任务结束失败");
			return false;
		}
	}


}
